/*!
 * Component: components/Index/index
 * License: MIT
 * Created: 2020-02-27 16:30
 */

import { GlobalData } from '/store/state'

Component({
  /**
   * Component properties
   */
  properties: {
    list: { type: null, value: [] },
  },

  /**
   * Component initial data [private]
   */
  data: {
    access: GlobalData.access,
  },

  /**
   * lifecycle of component
   */
  lifetimes: {
    attached() {
      this.setData({
        access: GlobalData.access,
      })
    },
  },

  /**
   * Component methods
   */
  methods: {
    toDetail(e: WechatMiniprogram.BaseEvent) {
      const id = e.currentTarget.dataset.id
      wx.navigateTo({
        url: `/index/information/detail/detail?id=${id}`,
      })
    },
  },
})
